home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Arsenal Files 8
/
The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO
/
pcboard
/
iemsi120.zip
/
TO8BIT.PPS
< prev
Wrap
Text File
|
1996-10-19
|
1KB
|
44 lines
; convert EMSI 7-bit data => 8-bit data
Declare Function To8Bit(BigStr Bit7) BigStr
Function To8Bit(BigStr Bit7) BigStr
Word x, y
String char
BigStr str
BigStr buffer
; fairly fast method; seek to escape code and process
For x = 1 to Len(Bit7)
; remaining string to process
buffer = Right(Bit7, Len(Bit7)-x+1)
; seek to escape code
y = InStr(buffer+"\", "\")-1
; add normal characters to output string
str = str+Left(buffer, y)
; set position
x = x+y
; if next character is and escape code, char = backslash
If (Mid(Bit7, x+1, 1) = "\") Then
char = "\"
Inc x
; next two characters are part of escape code (assumed)
Else
char = Chr(S2I(Mid(Bit7, x+1, 2), 16))
x = x+2
EndIf
; add characters to output string
str = str+char
Next
; handle special open/close field characters
str = ReplaceStr(str, "{{", "{")
str = ReplaceStr(str, "}}", "}")
str = ReplaceStr(str, "[[", "[")
str = ReplaceStr(str, "]]", "]")
; return value
To8Bit = str
EndFunc